const express = require('express')
const router = express.Router()

// 导入验证数据的中间件
const expressJoi = require('@escook/express-joi')
// 导入需要的验证规则对象
const {add_news_schema,update_news_schema} = require('../schema/news')

// 导入需要的处理函数模块
const {addNews, newsList, newsInfo, updateNews, delNews} = require('../router_handler/news')

router.delete('/:id', delNews)
router.get('/:id', newsInfo)
router.get('/', newsList)
router.post('/update', expressJoi(update_news_schema), updateNews)
router.post('/add', expressJoi(add_news_schema), addNews)

module.exports = router